package cn.webrx;

import java.util.*;

public class Iterator2 {

    public static void main(String[] args) {
      LinkedList<Integer> list = new LinkedList<>(List.of(1,2,3,4,5,6,8,9,10));
      list.add(1);

        Iterator<Integer> it = list.iterator();
        //it.hasNext() 用来判断迭代器对象有没有要输出的元素
        while(it.hasNext()){
            System.out.println(it.next());
        }


        for(Integer i : list){
            System.out.println(i);
        }

    }
}
